package 设计模式.行为模式.模板模式.service;

import org.springframework.stereotype.Component;
import 设计模式.行为模式.模板模式.UserDao;
import 设计模式.行为模式.模板模式.UserInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lchenglong
 * @date 2024/1/26
 */
@Component
public class UserDaoImpl implements UserDao {
    private static Map<String, UserInfo> userInfoMap = new HashMap<>();
    static {
        UserInfo zhangsan = new UserInfo();
        zhangsan.setUserName("zhangsan");
        zhangsan.setPassword("123");
        userInfoMap.put("zhangsan",zhangsan);
        userInfoMap.put("lisi",new UserInfo());
    }

    @Override
    public UserInfo queryByUserName(String userName) {
        return userInfoMap.get(userName);
    }

    @Override
    public int update(UserInfo userInfo) {
        return 0;
    }

    @Override
    public String querySmsCode(String phone) {
        return null;
    }
}
